import collections
class Solution(object):
    def numberOfWays(self, corridor):
        t = 0
        m = 0
        base = 10 ** 9 + 7
        ans = 1
        for c in corridor:
            if c == 'S':
                if t == 2:
                    t = 1
                    ans = ans * (m + 1) % base
                    m = 0
                else:
                    t += 1
            else:
                if t == 2:
                    m += 1
        if t == 2:
            return ans
        else:
            return 0



        
data = Solution()
corridor = "SSPPSPS"
print(data.numberOfWays(corridor))